import request from '@/utils/request'
import store from '@/stores/index.js'
// 收益数据
export async function integralInfo(showLoading = false) {
  const res = await request({
    url: '/box/integral/integral-info',
    method: 'get'
  })
  return res
}
// 我的箱起首页
export async function getMyBoxHome(params, showLoading = true) {
  const res = await request({
    url: '/stock/box/home',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 最高董事 云仓申购列表
export async function getTopPurchase(params, showLoading = true) {
  const res = await request({
    url: '/stock/apply-to-order/list',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 中间/终端用户 云仓申购列表
export async function getPurchase(params, showLoading = true) {
  const res = await request({
    url: '/stock/apply-to-superior/list',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}
// 中间/最高董事 审批列表
export async function getApproval(params, showLoading = true) {
  const res = await request({
    url: '/stock/approval/list',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 中间/最高董事 审批下级申购
export async function operateApproval(data, showLoading = true) {
  const res = await request({
    url: '/stock/normal/approval',
    method: 'post',
    data,
    headers: {
      showLoading
    }
  })
  return res
}

// 中间/终端用户 申购审批详情 --- 中间/最高董事 我的审批详情
export async function getApprovalDetail(params, showLoading = true) {
  const res = await request({
    url: '/stock/apply/detail',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 中间/终端用户 申购审批详情 撤销申购
export async function revokePurchase(data, showLoading = true) {
  const res = await request({
    url: '/stock/apply/revoke',
    method: 'post',
    data,
    headers: {
      showLoading
    }
  })
  return res
}

// 获取上级用户申购信息
export async function getParentMsg(params, showLoading = false) {
  const res = await request({
    url: '/stock/user/apply/parent',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 终端/中间董事申请增加云仓库存
export async function stockApply(data, showLoading = true) {
  const res = await request({
    url: '/stock/normal/apply',
    method: 'post',
    data,
    headers: {
      showLoading
    }
  })
  return res
}

// 查询该箱起云仓可转换的列表
export async function queryStockTransform(params, showLoading = true) {
  const res = await request({
    url: '/stock/exchange/query',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 箱起云仓转换
export async function stockTransform(data, showLoading = true) {
  const res = await request({
    url: '/stock/exchange/submit',
    method: 'post',
    data,
    headers: {
      showLoading
    }
  })
  return res
}
// 通过手机查询昵称
export async function queryName(params, showLoading = true) {
  const res = await request({
    url: '/stock/user/child/info',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 查询本人的云仓商品完整信息
export async function queryStockInfo(params, showLoading = true) {
  const res = await request({
    url: '/stock/complete-info-with-check',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}

// 云仓下拨
export async function stockAllocate(data, showLoading = true) {
  const res = await request({
    url: '/stock/allocate',
    method: 'post',
    data,
    headers: {
      showLoading
    }
  })
  return res
}

//查询箱起用户信息
export async function userInfo(params, showLoading = true) {
  const res = await request({
    url: '/box/integral/user-info',
    method: 'get',
    params,
    headers: {
      showLoading
    }
  })
  return res
}


//获取我的用户收益
export async function userPromotion(params, showLoading = true) {
  const res = await request({
    url: '/box/integral/user-promotion',
    method: 'get',
    params
  })
  return res
}